//
//  MXSEditMenuBtn.swift
//  weibo
//
//  Created by 孙飞 on 15/12/16.
//  Copyright © 2015年 Sunfei. All rights reserved.
//

import UIKit

class MXSEditMenuBtn: UIButton {

    override var highlighted: Bool{
    
        set {}
        get { return false}

    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        //初始化时 设置button的属性
        backgroundColor = RandomColor()
        titleLabel?.font = UIFont.systemFontOfSize(14)
        titleLabel?.textAlignment = .Center
        setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        imageView?.contentMode = .Center
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        // 调整 imageView
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width
        
        // 调整 titleLabel
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
        
    }

}
